<style type="text/css">
#search{margin:5px auto 0px;width:696px;}
#search form .input1{color:#ccc;width:649px;border:2px solid #cccccc;float:left;height:20px;line-height:20px;}
#search form .input2{border:none;background:#ccc;float:left;color:#333;cursor:pointer;width:43px;height:24px;line-height:24px;}
#searchlist{width:649px;border:2px solid #cccccc;border-top:none;line-height:20px;position:absolute;left:0px;top:24px;background:#fff;z-index:100;display:none;}
#searchlist li{padding-left:10px;text-align:left;}
#searchlist li:hover{background:#efefef;}
</style>
<div id="search">
	<form action="<?php echo url('clientgame/list');?>" method="GET" onsubmit="if($('#keywordss').val()=='' || $('#keywordss').val()=='✎在此输入游戏名称进行模糊搜索'){alert('请输入游戏名称');return false;}">
		<input type="text" name="name" id="keywordss" class="input1"
				onblur=" if(this.value==''){this.value='✎在此输入游戏名称进行模糊搜索';}this.style.color='#ccc';"
				onfocus="if(this.value=='✎在此输入游戏名称进行模糊搜索'){this.value='';}this.style.color='#000';"
				value="<?php echo isset($_GET['name']) ? trim($_GET['name']) : '✎在此输入游戏名称进行模糊搜索';?>" 
				onkeyup="searchbykeywords(this.value)" />
		<input type="submit" value="搜 索" class="input2" />
		<div class="clear"></div>
	</form>	
	<ul id="searchlist"></ul>
</div>

<script type="text/javascript">
function searchbykeywords(v){
	if(v.length>0){
		$.post('<?php echo url('default/search')?>',{'key':v},function(msg){
			if(msg==''){
				$('#searchlist').hide();
			}else{
				$('#searchlist').html(msg);
				$('#searchlist').show();
			}
			$('#searchlist li').click(function(){
				if($(this).attr('name')!=undefined){
					$('#keywordss').val($(this).attr('name'));
					$('#search form').submit();
					$('#searchlist').hide();
				}				
			});
		});
	}
}
</script>
